package cn.xm.basic.controller;

import cn.xm.basic.dto.BindUserDto;
import cn.xm.basic.result.AjaxResult;
import cn.xm.basic.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     * 微信扫码登录接口
     * @param code
     * @return
     */
    @PostMapping("/wechat")
    public AjaxResult wechatLogin(@RequestBody String code) {
        return loginService.wechatLogin(code);
    }

    @PostMapping("/wechat/binder")
    public AjaxResult wechatBinder(@RequestBody BindUserDto bindUserDto) {
        return loginService.wechatBinder(bindUserDto);
    }


}
